<?php
	//链接数据库
	$data = new mysqli('127.0.0.1','root','','wanka');
	//设置中文
	mysqli_query($data,"SET NAMES utf8");
	//设置查询语句
	$sql = 'select * from news';
	//执行
	$query = mysqli_query($data,$sql);
	$arr = [];
	while($row=mysqli_fetch_assoc($query)){
			$arr[] = $row;
	}

	// $num = mysqli_fetch_row($query);
	// var_dump($num);
	
	echo json_encode($arr);
	mysqli_close($data);
?>